package com.example.ujsfish.utils;



import com.example.ujsfish.model.DeviceBody;
import com.example.ujsfish.model.DeviceLocateBody;
import com.example.ujsfish.model.ObstaclesPoint;
import com.example.ujsfish.model.PlanPathBody;
import com.example.ujsfish.model.PlanPointBody;
import com.example.ujsfish.model.boundary.BoundaryBody;
import com.example.ujsfish.model.boundary.ObstaclesBody;
import com.example.ujsfish.model.manual.ManualControlData;
import com.example.ujsfish.model.manual.SemiManualCtrlData;
import com.example.ujsfish.model.monitor.MonitorBody;
import com.example.ujsfish.model.monitor.JsonRootBean;
import com.example.ujsfish.model.ship.PoolName;
import com.example.ujsfish.model.user.LoginBody;

import java.util.List;

import okhttp3.ResponseBody;
import retrofit2.Call;
import retrofit2.http.Body;
import retrofit2.http.Field;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET;
import retrofit2.http.POST;
import retrofit2.http.Query;

public interface AppNetService {


    //pathPlan Controller


    /**
     * 添加规划路径
     * @param pool_id
     * @param path_id
     * @param userName
     * @param planPointBodyList
     * @return
     */
    @POST("pathplan/addPath")
    Call<ResponseBody> postAddPath(@Query("pool_id") String pool_id, @Query("path_id") String path_id, @Query("username") String userName, @Body List<PlanPointBody> planPointBodyList);

    /**
     * 查询所有池塘名
     * @param pool_id
     * @return
     */
    @FormUrlEncoded
    @POST("pathplan/findAPoolPathsNames")
    Call<PoolName> postFindPoolPathName(@Field("pool_id") String pool_id);

    @FormUrlEncoded
    @POST("pathplan/findAPoolPathsNamesByUsername")
    Call<PoolName> postFindPoolPathNameBU(@Field("pool_id") String pool_id, @Field("username") String user_name);


    /**
     * 寻找指定路径规划的点
     * @param pool_id
     * @param path_id
     * @return
     */
    @FormUrlEncoded
    @POST("pathplan/findPath")
    Call<PlanPathBody> postFindPath(@Field("pool_id") String pool_id, @Field("path_id") String path_id);

    /**
     * 寻找指定路径规划的点
     * @param pool_id
     * @param path_id
     * @return
     */
    @FormUrlEncoded
    @POST("pathplan/findPathByUsername")
    Call<PlanPathBody> postFindPathBU(@Field("pool_id") String pool_id, @Field("path_id") String path_id, @Field("username") String user_name);




    /**
     * 查询现有全部池塘id
     * @return
     */
    @GET("pool/findAllPoolNames")
    Call<PoolName> postFindPoolNames();


    /**
     * 根据userName查询所有池塘id
     * @param userName
     * @return
     */
    @FormUrlEncoded
    @POST("pool/findAllPoolNamesBU")
    Call<PoolName> postFindPoolNameBU(@Field("username") String userName);

    //池塘障碍点和边界点

    /**
     * 添加边界点
     * @param id
     * @param points_name
     * @param points
     * @param userName
     * @return
     */
    @FormUrlEncoded
    @POST("pool/addBoundaryPoints   ")
    Call<ResponseBody> postAddBoundary(@Field("id") String id, @Field("points_name") String points_name, @Field("points") String points, @Field("username") String userName);

    /**
     * 添加障碍点
     * @param obstaclesPoint
     * @return
     */
    @POST("pool/addObstaclesPoints")
    Call<ResponseBody> postAddObstacles(@Body ObstaclesPoint obstaclesPoint);


    /**
     * 根据id查找障碍点
     * @param pool_id
     * @return
     */
    @FormUrlEncoded
    @POST("pool/findObstaclesPoint")
    Call<ObstaclesBody> postFindObstaclesPoints(@Field("pool_id") String pool_id );


    /**
     * 根据id和username查找障碍点
     * @param pool_id
     * @return
     */
    @FormUrlEncoded
    @POST("pool/findObstaclesPointBU")
    Call<ObstaclesBody> postFindObstaclesPointsBU(@Field("pool_id") String pool_id, @Field("username") String user_name);


    //pool Controller

    /**
     * 根据池塘id查询边界点
     * @param id
     * @return
     */
    @FormUrlEncoded
    @POST("pool/findBoundaryPoint")
    Call<BoundaryBody> postFindBoundary(@Field("id") String id);

    /**
     * 根据池塘id与userName查询边界点
     * @param id
     * @return
     */
    @FormUrlEncoded
    @POST("pool/findBoundaryPointBU")
    Call<BoundaryBody> postFindBoundaryBU(@Field("id") String id, @Field("username") String userName);

    //system

    @FormUrlEncoded
    @POST("system/user_device")
    Call<PoolName> postFindDeviceBU(@Field("user_device") String userName);


    /**
     * 依据船的id删除设备
     * @param deviceName
     * @return
     */
    @FormUrlEncoded
    @POST("system/deleteByIddevice")
    Call<ResponseBody> postDeleteDevice(@Field("device_name") String deviceName);


    /**
     * 依据id来删除日志信息
     * @param row
     * @return
     */
    @FormUrlEncoded
    @POST("system/deletelog")
    Call<ResponseBody> postDeleteLog(@Field("row") Integer row);

    /**
     * 删除上行数据信息
     * @param row
     * @return
     */
    @FormUrlEncoded
    @POST("system/deletemsg")
    Call<ResponseBody> postDeleteMsg(@Field("row") Integer row);

    /**
     * 查询已有的设备列表信息
     * @param start
     * @param end
     * @return
     */
    @FormUrlEncoded
    @POST("system/device")
    Call<DeviceBody> postDeviceList(@Field("start") Integer start, @Field("end") Integer end);

    /**
     * 依据区间来查询指定长度的日志信息
     * @param start
     * @param end
     * @return
     */
    @FormUrlEncoded
    @POST("system/device")
    Call<ResponseBody> postLog(@Field("start") Integer start, @Field("end") Integer end);

    /**
     * 实时数据监控
     * @param Id
     * @return
     */
    @FormUrlEncoded
    @POST("system/monitor")
    Call<JsonRootBean> postMonitor(@Field("id") String Id);

    /**
     * 根据船的id和区间查询指定长度的信息
     * @param id
     * @param start
     * @param end
     * @return
     */
    @FormUrlEncoded
    @POST("system/msg")
    Call<MonitorBody> postMsg(@Field("id") String id, @Field("start") Integer start, @Field("end") Integer end);

    /**
     * 依据船的id修改设备主人
     * @param user_name 将船主修改成为此用户
     * @param device_name 需要被修改船主的船
     * @return
     */
    @FormUrlEncoded
    @POST("updateByIduser")
    Call<ResponseBody> updateByIduser(@Field("user_name") String user_name, @Field("device_name") String device_name);

    /**
     * 获取在线船只的位置及信息
     * @return
     */
    @GET("system/device_locate")
    Call<DeviceLocateBody> getDeviceLocate();

    /**
     * 获取船只的数量
     * @return
     */
    @GET("system/device_num")
    Call<ResponseBody> getDeviceNumber();

    /**
     * 获取在线船只的数量
     * @return
     */
    @GET("system/device_num_on")
    Call<ResponseBody> getOnlineDeviceNumber();

    /**
     * 查询日志信息长度
     * @return
     */
    @GET("system/log_num")
    Call<ResponseBody> getLogNumber();

    /**
     * 查询今日下行信息详细长度
     * @return
     */
    @GET("system/log_num_detail")
    Call<ResponseBody> getLogNumDetail();

    /**
     * 查询今日日志信息长度
     * @return
     */
    @GET("system/log_num_today")
    Call<ResponseBody> getLogNumToday();


//Instruction Controller

    /**
     * 驻泊
     * @param deviceName
     * @return
     */
    @FormUrlEncoded
    @POST("boat/Parking")
    Call<ResponseBody> postParking(@Field("deviceName") String deviceName);

    /**
     * 驻泊
     * @param deviceName
     * @return
     */
    @FormUrlEncoded
    @POST("boat/weigh")
    Call<ResponseBody> postWeigh(@Field("deviceName") String deviceName);

    /**
     * 新杂鱼饵料巡航
     * @param deviceName
     * @param pool_id
     * @param path_id
     * @return
     */
    @FormUrlEncoded
    @POST("boat/Baiting_endurance_New")
    Call<ResponseBody> postBaiting_endurance_New(@Field("devicename") String deviceName, @Field("pool_id") String pool_id, @Field("path_id") String path_id);


    /**
     * 新颗粒饵料巡航
     * @param deviceName
     * @param pool_id
     * @param path_id
     * @return
     */
    @FormUrlEncoded
    @POST("boat/Feeding_Cruise_New")
    Call<ResponseBody> postFeeding_Cruise_New(@Field("devicename") String deviceName, @Field("pool_id") String pool_id, @Field("path_id") String path_id);

    /**
     * 新施药巡航
     * @param deviceName
     * @param pool_id
     * @param path_id
     * @return
     */
    @FormUrlEncoded
    @POST("boat/Spraying_Cruise_New")
    Call<ResponseBody> postSpraying_Cruise_New(@Field("devicename") String deviceName, @Field("pool_id") String pool_id, @Field("path_id") String path_id);

    /**
     * 根据船id执行施药续航
     * @param deviceName
     */
    @FormUrlEncoded
    @POST("boat/Application_duration")
    Call<ResponseBody> postSprayingRe(@Field("deviceName") String deviceName);

    /**
     * 发送半自动控制指令
     * @param semiAutoBody
     */
    @POST("boat/Automatic_control")
    Call<ResponseBody> postSemiAutoControl(@Body SemiManualCtrlData.SemiAutoBody semiAutoBody );

    /**
     * 根据设备的id来执行投饵续航指令
     * @param deviceName
     */
    @FormUrlEncoded
    @POST("boat/Baiting_endurance")
    Call<ResponseBody> postBaitingRe(@Field("deviceName") String deviceName);


    /**
     * 根据设备的id来执行巡航暂停指令
     * @param deviceName
     */
    @FormUrlEncoded
    @POST("boat/Cruise_pause")
    Call<ResponseBody> postCruisePause(@Field("deviceName") String deviceName);

    /**
     * 根据设备的id来执行投饵巡航指令
     * @param deviceName
     */
    @FormUrlEncoded
    @POST("boat/Feeding_Cruise")
    Call<ResponseBody> postFeeding_Cruise(@Field("deviceName") String deviceName);

    /**
     * 根据设备的id来执行地磁校准指令
     * @param deviceName
     */
    @FormUrlEncoded
    @POST("boat/Geomagnetic_calibration")
    Call<ResponseBody> postGeomagnetic_calibration(@Field("deviceName") String deviceName);

    /**
     * 根据设备的id来执行手动控制指令
     * @param manualControlBody
     */

    @POST("boat/Manual_control")
    Call<ResponseBody> postManualControl(@Body ManualControlData.ManualBody manualControlBody );

    @FormUrlEncoded
    @POST("boat/weighing")
    Call<ResponseBody> postReWeighing(@Field("deviceName") String deviceName);

    /**
     * 根据设备的id来执行原点校准指令
     * @param deviceName
     */
    @FormUrlEncoded
    @POST("boat/Origin_calibration")
    Call<ResponseBody> postOrigin_calibration(@Field("deviceName") String deviceName);

    /**
     * 根据设备的id来执行返航指令
     * @param deviceName
     */
    @FormUrlEncoded
    @POST("boat/Return")
    Call<ResponseBody> postReturn(@Field("deviceName") String deviceName);

    /**
     * 根据设备的id来执行施药巡航指令
     * @param deviceName
     */
    @FormUrlEncoded
    @POST("boat/Spraying_Cruise")
    Call<ResponseBody> postSpraying_Cruise(@Field("deviceName") String deviceName);



    @FormUrlEncoded
    @POST("boat/download")
    Call<ResponseBody> postGetAccount(@Field("devicename") String deviceName, @Field("account") String account);

    /**
     * 根据设备的id来执行停车指令
     * @param deviceName
     */
    @FormUrlEncoded
    @POST("boat/stop")
    Call<ResponseBody> postStop(@Field("deviceName") String deviceName);

    //用户操作 : User Controllerl

    @FormUrlEncoded
    @POST("user/login")
    Call<LoginBody> postLogin(@Field("id") String id, @Field("password") String password);


}
